<?php

$oDb =& Database::get();

$iVersion = $oDb->getField("
			SELECT COUNT(*) FROM
			`". App::getT('versions') ."`
			WHERE `title` = '". App::getParam('info.version') ."' AND `build` = '". App::getParam('info.build')."'
		");

if ( !isset($_SESSION['update_version']) )
{
	$oDb = &Database::get();
	$oDb->update(App::getT('versions'), array('using' => ''), "title != '". App::getParam('info.version') ."'");
	$oDb->update(App::getT('versions'), array('using' => '1', 'build' => App::getParam('info.build')), "title = '". App::getParam('info.version') ."'");
	$_SESSION['update_version'] = true;
}

?>